package cn.livingCloud.controller.user.front;

import cn.livingCloud.service.ImageUploadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Created by sujiantang on 2015/12/21.
 */
@Controller
@RequestMapping("/image")
public class ImageFrontController {

    @Autowired
    @Qualifier("imageUploadServiceImpl")
    private ImageUploadService uploadService;

    /**
     * 显示图片
     *
     * @param response 响应对象,用来获取响应流
     * @param name     图片资源的uuid
     */
    @RequestMapping("/{name}")
    public void loadImage(HttpServletResponse response, HttpServletRequest request, @PathVariable("name") String name) {
        uploadService.loadImage(response, request, name);
    }


}
